package com.itheima.mapper;

import com.itheima.bean.Card;
import com.itheima.bean.Person;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;
public interface CardMapper {
    /*
    * 注解开发
    * */
    /*@Select("select * from card")
    @Results({
            @Result(property="id",column="id"),
            @Result(property="number",column="number"),
            @Result(property="p",column="pid",
                    javaType=Person.class,
                    one = @One(select="com.itheima.mapper.PersonMapper.findById")
            )
    })*/
    @Select("select * from card")
    @Results({
            @Result(property = "id",column = "id"),
            @Result(property = "number",column = "number"),
            @Result(property = "p",column = "pid",
                    javaType = Person.class,
                    one = @One(select="com.itheima.mapper.PersonMapper.findById")
            )

    })

    List<Card> findAll();
}
